package com.bistu.notepad_zjr.util;

import android.content.Context;
import android.content.SharedPreferences;


public class SpfUtil {

    private static String File_NAME = "Author";     //文件名
    public static int MODE = Context.MODE_PRIVATE;  //私有模式

    //保存
    public static void saveSPF(Context context, String key, String value) {
        SharedPreferences spf = context.getSharedPreferences(File_NAME, MODE);
        SharedPreferences.Editor edit = spf.edit();
        edit.putString(key, value);
        edit.apply();
//        editor_zjr.commit();
    }

    //加载
    public static String loadSPF(Context context,String key) {
        SharedPreferences spf = context.getSharedPreferences(File_NAME, MODE);
        return spf.getString(key, "我是默认值");
    }

}
